﻿CREATE PROCEDURE [dbo].[yaf_user_saveavatar](
                @UserID      INT,
                @Avatar      NVARCHAR(255)  = NULL,
                @AvatarImage IMAGE  = NULL)
AS
    BEGIN
        IF @Avatar IS NOT NULL
        BEGIN
            UPDATE yaf_User
            SET    Avatar = @Avatar,
                   AvatarImage = NULL
            WHERE  UserID = @UserID
        END
        ELSE
        IF @AvatarImage IS NOT NULL
        BEGIN
            UPDATE yaf_User
            SET    AvatarImage = @AvatarImage,
                   Avatar = NULL
            WHERE  UserID = @UserID
        END
    END


